package ru.sviridov.sellandbuy.tasks.recipients;

import ru.sviridov.sellandbuy.model.Response;
import ru.sviridov.sellandbuy.tasks.base.TaskRecipient;
import android.app.Activity;
import android.content.Context;
import android.widget.Toast;

public class RestorePasswordRecipient implements TaskRecipient {

	@Override
	public void onURLError(Context context, int errorCode) {
		if(context!=null)
			Toast.makeText(context, "server connection error", Toast.LENGTH_LONG).show();
	}

	@Override
	public void onJSONError(Context context, Response response) {
		if(context!=null)
			Toast.makeText(context, response.getErrorMessage(), Toast.LENGTH_LONG).show();
	}

	@Override
	public void onSuccess(Context context, Response response) {
		if(context==null) return;
		
		//TODO implement restored password logic
		((Activity)context).finish();
	}

}
